<template>
  <el-dialog
      append-to-body
      :visible.sync="dialogVisible"
      width="80%"
      @close="dialogClose"
      center>
    <basic-container>
      <avue-crud
          ref="avueCrud"
          v-bind="bindVal"
          v-on="onEvent"
          :page.sync="page"
          v-model="startForm">
      </avue-crud>
    </basic-container>
  </el-dialog>
</template>

<script>

import {createStartMixin} from "@/mixins/start-crud.js"

export default {
  mixins: [createStartMixin({name: "sys/dictionaryItem"})],
  data() {
    return {
      dialogVisible: false,
      dictionaryId: null,
      isLoading: false,
    }
  },
  methods: {
    show(dictionaryId) {
      this.dictionaryId = dictionaryId
      this.searchParams.search_dictionaryId = dictionaryId;
      let itemParentId = this.findObject(this.tableOption.column, "parentId");
      itemParentId.dicQuery.dictionaryId = dictionaryId;
      this.dialogVisible = true
      this.$ref.avueCrud.init();
      this.page.currentPage = 1;
      if (!this.isLoading) {
        this.refreshChange()
      }
      this.restLoadList();
    },
    getListBefore(searchParams) {
      searchParams.start_search_dictionaryId = this.dictionaryId;
    },
    dialogClose() {
      this.dialogVisible = false
      this.isLoading = true;
      this.searchParams.dictionaryId = null;
      this.dataSource = []
    },
    rowSaveBefore(row, index) {
      row.dictionaryId = this.dictionaryId;
    }
  }
}
</script>

<style scoped>

</style>
